package com.healthcloud.service;

import com.healthcloud.entity.PatientRecord.RecordInfoVo;
import com.healthcloud.entity.TestresultEntity;
import com.healthcloud.entity.testresult.TestResultDto;
import com.healthcloud.entity.testresult.TestresultVo;
import com.healthcloud.utils.DateUtils;
import com.healthcloud.utils.PageParam;
import io.swagger.annotations.ApiParam;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;

/**
 * 检测结果
 *
 * @author yucl
 * @email yucailong1111@126.com
 * @date 2018-05-31 16:20:16
 */
public interface TestresultService {

    void saveBloodSugar(TestresultEntity testresult);
    void saveBloodPressure(String idCard, Double szyValue, Double ssyValue, Double heartRate, Date testTime);

    TestresultEntity queryObject(Long id);

    List<TestresultEntity> queryList(TestresultEntity bean, PageParam pageParam);

    int queryTotal(TestresultEntity bean);

    void save(TestresultEntity testresult);

    void update(TestresultEntity testresult);

    void delete(Long id);

    void deleteBatch(Long[] ids);

    List<TestresultEntity> queryResult(TestresultEntity entity, String companyId, PageParam pageParam);

    int countResult(TestresultEntity entity, String companyId);

    List<TestresultEntity> queryBySN(String mkMedicalInstrumenId);

    int countResultBySN(String mkMedicalInstrumenId);

    List<TestresultEntity> queryResultBySN(String mkMedicalInstrumenId, PageParam pageParam);

    List<RecordInfoVo> queryRecord(String idCard, String testKindCode, String beginTime, String endTime, PageParam pageParam);

    int countRecord(String idCard, String testKindCode, String beginTime, String endTime);

    List<TestresultEntity> queryLastBp(String idCard);

    String[] queryListTime(String idCard, String beginTime, String endTime, PageParam pageParam);

    /**
     * 根据身份证号、开始时间和结束时间，查询测试时间
     *
     * @param idCard
     * @param beginTime
     * @param endTime
     * @return
     */
    String[] listTestTimeByIdCardAndTime(String idCard, String beginTime, String endTime);

    List<TestresultEntity> queryByListTime(String idCard, String[] testTime);

    int countByListTime(String idCard, String[] testTime);

    TestresultEntity queryLastBg(String idCard, Integer testItemCode);

    List<TestresultEntity> queryBgList(String idCard, Integer testItemCode, PageParam pageParam);

    List<TestresultEntity> searchBgList(String idCard, Integer testKindCode, String beginTime, String endTime, PageParam pageParam);

    int countBgList(String idCard, Integer testKindCode, String beginTime, String endTime);

    List<TestresultEntity> queryRecordDetail(String idCard, Integer testKindCode, String testTime);

    List queryPatientTests(TestresultVo entity, PageParam pageParam);

    List queryPatientBpTests(TestresultVo entity, PageParam pageParam);

    int queryPatientTestsCount(TestresultVo entity);

    int queryPatientBpTestsCount(TestresultVo entity);

    List resultAvgByDay(String idCard, String date, String testItemCodes);

    List<TestresultEntity> queryListVo(TestresultVo entity, PageParam pageParam);

    int queryTotalVo(TestresultVo entity);

    List queryPatientBfTests(TestresultVo entity, PageParam pageParam);

    int queryPatientBfTestsCount(TestresultVo entity);

    /**
     * 统计当年血压测试正常结果
     */
    int countPatientBpTestsCurrYear(String hospitalIds, String type);

    /**
     * 查找血糖记录
     *
     * @param entity
     * @param pageParam
     * @return
     */
    List patientBsTests(TestResultDto entity, PageParam pageParam);

    int coutPatientBsTests(TestResultDto entity);

    /**
     * 查找血压记录
     *
     * @param entity
     * @param pageParam
     * @return
     */
    List patientBpTests(TestResultDto entity, PageParam pageParam);

    int countPatientBpTests(TestResultDto entity);


    /**
     * 修改血糖数据
     * @param id
     * @param testItemCode
     */
    void updateBs(Integer id, String testItemCode, String testItemName);


    /**
     * 检测记录列表
     *
     * @param testResultDto
     * @param page
     * @return
     */
    List findList(TestResultDto testResultDto, PageParam pageParam);
    int countFindList(TestResultDto testResultDto);

}
